# -*- coding: utf-8 -*-
from abc import ABC
from app.views import CommonHandler
from app.configs import kj236_pool


class ReaderHandler(CommonHandler, ABC):
    async def get(self):
        sql = "SELECT readerid, placement, isvalid from m_reader"
        readers, items = [], kj236_pool.select(sql)
        for item in items:
            if item[2]:
                readers.append({'readerid': int(item[0]), 'regname': item[1]})
        await self.respose(data=readers)
